//
//  MovieTableViewCell.m
//  UI_APP_Project_Bean
//
//  Created by Gavin–fan on 16/6/23.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "MovieTableViewCell.h"
#import "BackPicLabelView.h"
#import "MovieModel.h"

@interface MovieTableViewCell ()

@property(nonatomic, retain)BackPicLabelView *backView;


@end






@implementation MovieTableViewCell



- (void)dealloc
{
    [_backView release];
    [_model release];
    [super dealloc];
}
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        self.backView = [[BackPicLabelView alloc]init];
        
        [self.contentView addSubview:_backView];
        
        [_backView release];
    }
    
    return self;
    
}


-(void)layoutSubviews{
    
    [super layoutSubviews];
    
    self.backView.frame = CGRectMake(10, 10, self.contentView.frame.size.width - 20, self.contentView.frame.size.height - 20);
//    self.backView.picView.image
    
    
    
}

-(void)setModel:(MovieModel *)model{
    if (_model != model) {
        [_model release];
        _model = [model retain];
    }
    self.backView.nameLabel.text = model.movieName;
    
    
    NSURL *url = [NSURL URLWithString:model.pic_url];
    NSData *data = [NSData dataWithContentsOfURL:url];
    UIImage *image = [UIImage imageWithData:data];
    self.backView.picView.image = image;
    
    
    
    
    
    
}


















@end
